﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lingopen.Foxconn.Test.Api
{
    class Program
    {
        static void Main(string[] args)
        {
        Restart:
            Console.WriteLine("请输入 EmployeeNo");
            string EmployeeNo = Console.ReadLine();
            Console.WriteLine("请输入 EmployeeName");
            string EmployeeName = Console.ReadLine();
            Console.WriteLine("请输入 EmpLocation");
            string EmpLocation = Console.ReadLine();
            Console.WriteLine("请输入 DeviceAddr");
            string DeviceAddr = Console.ReadLine();
            Console.WriteLine("请输入 DeviceAddrType");
            string DeviceAddrType = Console.ReadLine();
            Console.WriteLine("请输入 AlarmStatus");
            string AlarmStatus = Console.ReadLine();
            Console.WriteLine("请输入 DeviceName");
            string DeviceName = Console.ReadLine();
            Console.WriteLine("请输入 Rssi");
            string Rssi = Console.ReadLine();
            try
            {
                string pars = $"EmployeeNo={EmployeeNo}&EmployeeName={EmployeeName}&EmpLocation={EmpLocation}&DateTime={DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}&DeviceAddr={DeviceAddr}&DeviceAddrType={DeviceAddrType}&AlarmStatus={AlarmStatus}&DeviceName={DeviceName}&DeviceRssi={Rssi}";
                var xml = HttpCrossDomain.POST("http://safe.foxconn.com:443/temporaryvisitcheck/service1.asmx/GetguardPositionInfo", pars);
                xml = xml.Replace("xmlns=\"http://tempuri.org/\"", "");
                Console.WriteLine("API 调用结果：{0}", xml);
                goto Restart;
            }
            catch (Exception ex)
            {
                Console.WriteLine("API 调用报错：{0}", ex);
            }

        }
    }
}
